package com.yf.service;

import com.yf.entity.TokenEntity;
import com.yf.entity.UserEntity;
import com.yf.entity.WxUser;
import com.yf.service.BaseService;
import com.yf.vo.UserBackVo;
import com.yf.vo.UserVO;

import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 用户Service接口
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Tue Aug 21 10:46:07 CST 2018
 */
public interface UserService extends BaseService<UserEntity>{

    /**
     * 普通注册用户
     * @param phone
     * @param password
     * @param name
     * @param uuid
     * @param captcha
     * @return
     */
    TokenEntity registerUser(String phone,String password,String name,String uuid,String captcha,String parentPhone);

    /**
     * 注册用户
     * @param code
     * @param parentId
     * @return
     */
    TokenEntity registerUser(WxUser wxUser, Long parentId);

    /**
     * 完善用户信息
     * @param name
     * @param info
     * @param phone
     * @param avatar
     * @return
     */
    UserEntity completeUserInfo(UserEntity userEntity,String name,String info,String phone,String avatar);

    /**
     * 验证用户是否登录
     * @return
     */
    TokenEntity validateLogin(UserEntity userEntity);

    /**
     * 通过统一ID获取
     * @return
     */
    UserEntity findByUnionId(String unionId);


    /**
     * 查找所有下级
     * @return
     */
    List<UserEntity> findDownByTree(UserEntity userEntity);

    /**
     * 查找直接下级
     * @param userEntity
     * @return
     */
    List<UserEntity> findDown(UserEntity userEntity);

    /**
     * 查找所有上级
     * @return
     */
    List<UserEntity> findUpByTree(UserEntity userEntity);

    /**
     *
     * @param parent
     */
    void updateParent(UserEntity user,UserEntity parent);




    /**
     * 创建图片验证码
     * @return
     */
    BufferedImage createImageCaptcha(String uuid);


    void createPhoneCaptcha(String uuid,String phone);

    /**
     * 账号密码+验证码登录
     * @param account
     * @param password
     * @param uuid
     * @param captcha
     * @return
     */
    UserEntity  loginByPassword(String phone,String password,String uuid,String captcha);


    UserEntity  loginByKaptcha(String phone,String uuid,String kaptcha);



    /**
     *
     * 查询user信息
     *
     */
    List<UserVO> getUserInfoList(Long[] userIds);

    UserVO getUser(Long userId);

    List<UserBackVo> userList(Map<String, Object> params);



}
